# Copyright 2004-present Facebook. All Rights Reserved.

import os

SUPPORTED_PLATFORMS = '^android-(armv7|x86)$'

def unpack_rule(source, from_rule):
  genrule(
    name = source,
    out = source,
    cmd = 'unzip -c -q $(location {0}) {1} > $OUT'.format(from_rule, source),
  )

def add_gen_source(source):
  _, ext = os.path.splitext(source)
  if ext == '.h':
    JSC_HEADERS[source] = ':' + source
  else:
    JSC_SOURCES.append(':' + source)

###### END INSPECTOR SOURCES ######

WTF_EXPORTED_PREPROCESSOR_FLAGS = [
  '-D_GLIBCXX_USE_C99_MATH=1',
  '-D__GXX_EXPERIMENTAL_CXX0X__',
  '-DENABLE_GLOBAL_FASTMALLOC_NEW=0',
]

# Dirty hack, StdLibExtras.h assumes incorrectly that is_trivially_destructible
# have been added in 4.8.1 version while it was added in 4.8.0. We emulate PATCH
# version to be 1 so that StdLibExtra.h doesn't try to declare
# is_trivially_destructible
# Except from this single place JSC code doesn't check for 4.8.1 anywhere else
WTF_EXPORTED_PREPROCESSOR_FLAGS.extend([
  '-U__GNUC_PATCHLEVEL__',
  '-D__GNUC_PATCHLEVEL__=1',
  '-DPTHREAD_KEYS_MAX=1024',
  '-DINTPTR_MAX=LONG_MAX',
  '-Dlog2(x)=(log(x)/log(2.0))',
])

cxx_library(
  name = 'wtfassertions',
  force_static = True,
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  exported_preprocessor_flags = WTF_EXPORTED_PREPROCESSOR_FLAGS,
  preprocessor_flags = [
    '-DLOG_TAG="WTF"',
    '-U__linux__',
  ],
  header_namespace = '',
  headers = subdir_glob([
    ('WTF', '*.h'),
    ('WTF/wtf', '*.h'),
  ]),
  exported_headers = subdir_glob([
    ('WTF', 'wtf/**/*.h'),
    ('WTF', 'wtf/text/*.h'),
    ('extra_headers', 'langinfo.h'),
  ]),
  srcs = ['WTF/wtf/Assertions.cpp'],
  deps = [
    '//icu:common',
  ],
)

cxx_library(
  name = 'wtf',
  soname = 'libwtf.so',
  force_static = True,
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  exported_preprocessor_flags = WTF_EXPORTED_PREPROCESSOR_FLAGS,
  preprocessor_flags = [
    '-DLOG_TAG="WTF"',

    # Disable icu collation and date formatting
    '-DUCONFIG_NO_COLLATION=1',
    '-DUCONFIG_NO_FORMATTING=1',
  ],
  header_namespace = '',
  headers = subdir_glob([
    ('WTF', '*.h'),
    ('WTF/wtf', '*.h'),
  ]),
  exported_headers = subdir_glob([
    ('WTF', 'wtf/**/*.h'),
    ('WTF', 'wtf/text/*.h'),
  ]),
  srcs = ['WTF/wtf/{0}'.format(f) for f in [
    'Atomics.cpp',
    'BitVector.cpp',
    'CompilationThread.cpp',
    'CryptographicallyRandomNumber.cpp',
    'CryptographicUtilities.cpp',
    'CurrentTime.cpp',
    'DataLog.cpp',
    'DateMath.cpp',
    'DecimalNumber.cpp',
    'dtoa.cpp',
    'dtoa/bignum-dtoa.cc',
    'dtoa/bignum.cc',
    'dtoa/cached-powers.cc',
    'dtoa/diy-fp.cc',
    'dtoa/double-conversion.cc',
    'dtoa/fast-dtoa.cc',
    'dtoa/fixed-dtoa.cc',
    'dtoa/strtod.cc',
    'FastBitVector.cpp',
    'FastMalloc.cpp',
    'FilePrintStream.cpp',
    'FunctionDispatcher.cpp',
    'gobject/GlibUtilities.cpp',
    'gobject/GMainLoopSource.cpp',
    'gobject/GRefPtr.cpp',
    'gobject/GThreadSafeMainLoopSource.cpp',
    'GregorianDateTime.cpp',
    'HashTable.cpp',
    'mbmalloc.cpp',
    'MD5.cpp',
    'MediaTime.cpp',
    'MetaAllocator.cpp',
    'NumberOfCores.cpp',
    'OSAllocatorPosix.cpp',
    'OSRandomSource.cpp',
    'PageAllocationAligned.cpp',
    'PageBlock.cpp',
    'ParallelJobsGeneric.cpp',
    'PrintStream.cpp',
    'RAMSize.cpp',
    'RandomNumber.cpp',
    'RefCountedLeakCounter.cpp',
    'SHA1.cpp',
    'SixCharacterHash.cpp',
    'SizeLimits.cpp',
    'StackBounds.cpp',
    'StackStats.cpp',
    'StringPrintStream.cpp',
    'TCSystemAlloc.cpp',
    'text/AtomicString.cpp',
    'text/AtomicStringTable.cpp',
    'text/Base64.cpp',
    'text/CString.cpp',
    'text/StringBuilder.cpp',
    'text/StringImpl.cpp',
    'text/StringStatics.cpp',
    'text/StringView.cpp',
    'text/WTFString.cpp',
    'ThreadIdentifierDataPthreads.cpp',
    'Threading.cpp',
    'ThreadingPthreads.cpp',
    'ThreadingWin.cpp',
    'ThreadSpecificWin.cpp',
    'unicode/UTF8.cpp',
    'WTFThreadData.cpp',
  ]],
  deps = [
    ':wtfassertions',
    '//icu:common',
  ],
)

cxx_library(
  name = 'wtfcollation',
  force_static = True,
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  header_namespace = '',
  headers = subdir_glob([
    ('WTF/wtf', '*.h'),
    ('', 'extra_headers/*.h'),
  ]),
  exported_headers = subdir_glob([
    ('WTF', 'wtf/**/*.h'),
    ('WTF', 'wtf/text/*.h'),
    ('', 'WTF/*.h'),
  ]),
  exported_preprocessor_flags = (
    WTF_EXPORTED_PREPROCESSOR_FLAGS + [
      # Disable icu collation and date formatting
      '-DUCONFIG_NO_COLLATION=1',
      '-DUCONFIG_NO_FORMATTING=1',
    ]),
  preprocessor_flags = [
    '-include', 'extra_headers/collation_hack.h',
    '-DLOG_TAG="WTF"',
  ],
  srcs = [
    'WTF/wtf/unicode/CollatorDefault.cpp',
  ],
  deps = [
    ':wtf',
  ],
)

genrule(
  name = 'llint_desired_offsets',
  out = 'LLIntDesiredOffsets.h',
  srcs =
    glob(['JavaScriptCore/offlineasm/*.rb']) +
    glob(['JavaScriptCore/llint/*.asm']) +
    [':InitBytecodes.asm'],
  cmd = ' '.join([
    'ruby',
    'JavaScriptCore/offlineasm/generate_offset_extractor.rb',
    '-IJavaScriptCore',
    '-I.',
    'JavaScriptCore/llint/LowLevelInterpreter.asm',
    '$OUT',
  ]),
)

# JSC

JSC_HEADERS = subdir_glob([
    ('JavaScriptCore', 'config.h'),
    ('WTF', 'wtf/**/*.h'),
    ('JavaScriptCore', 'JavaScriptCorePrefix.h'),
    ('', 'JavaScriptCore/API/*.h'),
    ('JavaScriptCore/API', '*.h'),
    ('JavaScriptCore/assembler', '*.h'),
    ('JavaScriptCore/bindings', '*.h'),
    ('JavaScriptCore', 'bindings/*.h'),
    ('JavaScriptCore/builtins', '*.h'),
    ('JavaScriptCore/bytecode', '*.h'),
    ('JavaScriptCore/bytecompiler', '*.h'),
    ('JavaScriptCore/debugger', '*.h'),
    ('JavaScriptCore', 'debugger/*.h'),
    ('JavaScriptCore/disassembler', '*.h'),
    ('JavaScriptCore/dfg', '*.h'),
    ('JavaScriptCore/ForwardingHeaders', '**/*.h'),
    ('JavaScriptCore/ftl', '*.h'),
    ('JavaScriptCore/heap', '*.h'),
    ('JavaScriptCore', 'heap/*.h'),
    ('JavaScriptCore/interpreter', '*.h'),
    ('JavaScriptCore', 'interpreter/*.h'),
    ('JavaScriptCore/inspector', '*.h'),
    ('JavaScriptCore', 'inspector/*.h'),
    ('JavaScriptCore/inspector/agents', '*.h'),
    ('JavaScriptCore/llint', '*.h'),
    ('JavaScriptCore/jit', '*.h'),
    ('JavaScriptCore/parser', '*.h'),
    ('JavaScriptCore/profiler', '*.h'),
    ('JavaScriptCore/runtime', '*.h'),
    ('JavaScriptCore', 'runtime/*.h'),
    ('JavaScriptCore/tools', '*.h'),
    ('JavaScriptCore/yarr', '*.h'),
    ('JavaScriptCore', 'yarr/*.h'),
  ]
)

JSC_SOURCES = [
  'JavaScriptCore/API/JSBase.cpp',
  'JavaScriptCore/API/JSCallbackConstructor.cpp',
  'JavaScriptCore/API/JSCallbackFunction.cpp',
  'JavaScriptCore/API/JSCallbackObject.cpp',
  'JavaScriptCore/API/JSClassRef.cpp',
  'JavaScriptCore/API/JSContextRef.cpp',
  'JavaScriptCore/API/JSObjectRef.cpp',
  'JavaScriptCore/API/JSProfilerPrivate.cpp',
  'JavaScriptCore/API/JSScriptRef.cpp',
  'JavaScriptCore/API/JSStringRef.cpp',
  'JavaScriptCore/API/JSValueRef.cpp',
  'JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp',
  'JavaScriptCore/API/OpaqueJSString.cpp',
  'JavaScriptCore/assembler/ARMAssembler.cpp',
  'JavaScriptCore/assembler/ARMv7Assembler.cpp',
  'JavaScriptCore/assembler/LinkBuffer.cpp',
  'JavaScriptCore/assembler/MacroAssembler.cpp',
  'JavaScriptCore/assembler/MacroAssemblerARMv7.cpp',
  'JavaScriptCore/assembler/MacroAssemblerX86Common.cpp',
  'JavaScriptCore/bindings/ScriptFunctionCall.cpp',
  'JavaScriptCore/bindings/ScriptObject.cpp',
  'JavaScriptCore/bindings/ScriptValue.cpp',
  'JavaScriptCore/builtins/BuiltinExecutables.cpp',
  'JavaScriptCore/bytecode/ArrayAllocationProfile.cpp',
  'JavaScriptCore/bytecode/ArrayProfile.cpp',
  'JavaScriptCore/bytecode/BytecodeBasicBlock.cpp',
  'JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp',
  'JavaScriptCore/bytecode/CallEdge.cpp',
  'JavaScriptCore/bytecode/CallEdgeProfile.cpp',
  'JavaScriptCore/bytecode/CallLinkInfo.cpp',
  'JavaScriptCore/bytecode/CallLinkStatus.cpp',
  'JavaScriptCore/bytecode/CallVariant.cpp',
  'JavaScriptCore/bytecode/CodeBlock.cpp',
  'JavaScriptCore/bytecode/CodeBlockHash.cpp',
  'JavaScriptCore/bytecode/CodeBlockJettisoningWatchpoint.cpp',
  'JavaScriptCore/bytecode/CodeOrigin.cpp',
  'JavaScriptCore/bytecode/CodeType.cpp',
  'JavaScriptCore/bytecode/ComplexGetStatus.cpp',
  'JavaScriptCore/bytecode/ConstantStructureCheck.cpp',
  'JavaScriptCore/bytecode/DeferredCompilationCallback.cpp',
  'JavaScriptCore/bytecode/DFGExitProfile.cpp',
  'JavaScriptCore/bytecode/ExecutionCounter.cpp',
  'JavaScriptCore/bytecode/ExitingJITType.cpp',
  'JavaScriptCore/bytecode/ExitKind.cpp',
  'JavaScriptCore/bytecode/GetByIdStatus.cpp',
  'JavaScriptCore/bytecode/GetByIdVariant.cpp',
  'JavaScriptCore/bytecode/InlineCallFrameSet.cpp',
  'JavaScriptCore/bytecode/JumpTable.cpp',
  'JavaScriptCore/bytecode/LazyOperandValueProfile.cpp',
  'JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp',
  'JavaScriptCore/bytecode/Opcode.cpp',
  'JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp',
  'JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp',
  'JavaScriptCore/bytecode/PreciseJumpTargets.cpp',
  'JavaScriptCore/bytecode/PutByIdStatus.cpp',
  'JavaScriptCore/bytecode/PutByIdVariant.cpp',
  'JavaScriptCore/bytecode/ReduceWhitespace.cpp',
  'JavaScriptCore/bytecode/SamplingTool.cpp',
  'JavaScriptCore/bytecode/SpecialPointer.cpp',
  'JavaScriptCore/bytecode/SpeculatedType.cpp',
  'JavaScriptCore/bytecode/StructureSet.cpp',
  'JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp',
  'JavaScriptCore/bytecode/StructureStubInfo.cpp',
  'JavaScriptCore/bytecode/ToThisStatus.cpp',
  'JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp',
  'JavaScriptCore/bytecode/UnlinkedInstructionStream.cpp',
  'JavaScriptCore/bytecode/ValueRecovery.cpp',
  'JavaScriptCore/bytecode/VariableWatchpointSet.cpp',
  'JavaScriptCore/bytecode/Watchpoint.cpp',
  'JavaScriptCore/bytecompiler/BytecodeGenerator.cpp',
  'JavaScriptCore/bytecompiler/NodesCodegen.cpp',
  'JavaScriptCore/debugger/Debugger.cpp',
  'JavaScriptCore/debugger/DebuggerCallFrame.cpp',
  'JavaScriptCore/debugger/DebuggerScope.cpp',
  'JavaScriptCore/dfg/DFGAbstractHeap.cpp',
  'JavaScriptCore/dfg/DFGAbstractValue.cpp',
  'JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp',
  'JavaScriptCore/dfg/DFGArithMode.cpp',
  'JavaScriptCore/dfg/DFGArrayMode.cpp',
  'JavaScriptCore/dfg/DFGAtTailAbstractState.cpp',
  'JavaScriptCore/dfg/DFGAvailability.cpp',
  'JavaScriptCore/dfg/DFGAvailabilityMap.cpp',
  'JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp',
  'JavaScriptCore/dfg/DFGBasicBlock.cpp',
  'JavaScriptCore/dfg/DFGBinarySwitch.cpp',
  'JavaScriptCore/dfg/DFGBlockInsertionSet.cpp',
  'JavaScriptCore/dfg/DFGBlockSet.cpp',
  'JavaScriptCore/dfg/DFGBlockWorklist.cpp',
  'JavaScriptCore/dfg/DFGByteCodeParser.cpp',
  'JavaScriptCore/dfg/DFGCapabilities.cpp',
  'JavaScriptCore/dfg/DFGCFAPhase.cpp',
  'JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp',
  'JavaScriptCore/dfg/DFGClobberize.cpp',
  'JavaScriptCore/dfg/DFGClobberSet.cpp',
  'JavaScriptCore/dfg/DFGCommon.cpp',
  'JavaScriptCore/dfg/DFGCommonData.cpp',
  'JavaScriptCore/dfg/DFGCompilationKey.cpp',
  'JavaScriptCore/dfg/DFGCompilationMode.cpp',
  'JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp',
  'JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp',
  'JavaScriptCore/dfg/DFGCriticalEdgeBreakingPhase.cpp',
  'JavaScriptCore/dfg/DFGCSEPhase.cpp',
  'JavaScriptCore/dfg/DFGDCEPhase.cpp',
  'JavaScriptCore/dfg/DFGDesiredIdentifiers.cpp',
  'JavaScriptCore/dfg/DFGDesiredTransitions.cpp',
  'JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp',
  'JavaScriptCore/dfg/DFGDesiredWeakReferences.cpp',
  'JavaScriptCore/dfg/DFGDesiredWriteBarriers.cpp',
  'JavaScriptCore/dfg/DFGDisassembler.cpp',
  'JavaScriptCore/dfg/DFGDoesGC.cpp',
  'JavaScriptCore/dfg/DFGDominators.cpp',
  'JavaScriptCore/dfg/DFGDriver.cpp',
  'JavaScriptCore/dfg/DFGEdge.cpp',
  'JavaScriptCore/dfg/DFGFailedFinalizer.cpp',
  'JavaScriptCore/dfg/DFGFinalizer.cpp',
  'JavaScriptCore/dfg/DFGFixupPhase.cpp',
  'JavaScriptCore/dfg/DFGFlushedAt.cpp',
  'JavaScriptCore/dfg/DFGFlushFormat.cpp',
  'JavaScriptCore/dfg/DFGFrozenValue.cpp',
  'JavaScriptCore/dfg/DFGFunctionWhitelist.cpp',
  'JavaScriptCore/dfg/DFGGraph.cpp',
  'JavaScriptCore/dfg/DFGGraphSafepoint.cpp',
  'JavaScriptCore/dfg/DFGHeapLocation.cpp',
  'JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp',
  'JavaScriptCore/dfg/DFGInsertOSRHintsForUpdate.cpp',
  'JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp',
  'JavaScriptCore/dfg/DFGInvalidationPointInjectionPhase.cpp',
  'JavaScriptCore/dfg/DFGJITCode.cpp',
  'JavaScriptCore/dfg/DFGJITCompiler.cpp',
  'JavaScriptCore/dfg/DFGJITFinalizer.cpp',
  'JavaScriptCore/dfg/DFGJumpReplacement.cpp',
  'JavaScriptCore/dfg/DFGLazyJSValue.cpp',
  'JavaScriptCore/dfg/DFGLICMPhase.cpp',
  'JavaScriptCore/dfg/DFGLivenessAnalysisPhase.cpp',
  'JavaScriptCore/dfg/DFGLongLivedState.cpp',
  'JavaScriptCore/dfg/DFGLoopPreHeaderCreationPhase.cpp',
  'JavaScriptCore/dfg/DFGMayExit.cpp',
  'JavaScriptCore/dfg/DFGMinifiedNode.cpp',
  'JavaScriptCore/dfg/DFGNaiveDominators.cpp',
  'JavaScriptCore/dfg/DFGNaturalLoops.cpp',
  'JavaScriptCore/dfg/DFGNode.cpp',
  'JavaScriptCore/dfg/DFGNodeFlags.cpp',
  'JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp',
  'JavaScriptCore/dfg/DFGObjectMaterializationData.cpp',
  'JavaScriptCore/dfg/DFGOperations.cpp',
  'JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp',
  'JavaScriptCore/dfg/DFGOSREntry.cpp',
  'JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp',
  'JavaScriptCore/dfg/DFGOSRExit.cpp',
  'JavaScriptCore/dfg/DFGOSRExitBase.cpp',
  'JavaScriptCore/dfg/DFGOSRExitCompiler.cpp',
  'JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp',
  'JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp',
  'JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp',
  'JavaScriptCore/dfg/DFGOSRExitJumpPlaceholder.cpp',
  'JavaScriptCore/dfg/DFGOSRExitPreparation.cpp',
  'JavaScriptCore/dfg/DFGPhantomCanonicalizationPhase.cpp',
  'JavaScriptCore/dfg/DFGPhantomRemovalPhase.cpp',
  'JavaScriptCore/dfg/DFGPhase.cpp',
  'JavaScriptCore/dfg/DFGPhiChildren.cpp',
  'JavaScriptCore/dfg/DFGPlan.cpp',
  'JavaScriptCore/dfg/DFGPredictionInjectionPhase.cpp',
  'JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp',
  'JavaScriptCore/dfg/DFGPrePostNumbering.cpp',
  'JavaScriptCore/dfg/DFGPromotedHeapLocation.cpp',
  'JavaScriptCore/dfg/DFGPureValue.cpp',
  'JavaScriptCore/dfg/DFGPutLocalSinkingPhase.cpp',
  'JavaScriptCore/dfg/DFGResurrectionForValidationPhase.cpp',
  'JavaScriptCore/dfg/DFGSafepoint.cpp',
  'JavaScriptCore/dfg/DFGSpeculativeJIT.cpp',
  'JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp',
  'JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp',
  'JavaScriptCore/dfg/DFGSSACalculator.cpp',
  'JavaScriptCore/dfg/DFGSSAConversionPhase.cpp',
  'JavaScriptCore/dfg/DFGSSALoweringPhase.cpp',
  'JavaScriptCore/dfg/DFGStackLayoutPhase.cpp',
  'JavaScriptCore/dfg/DFGStaticExecutionCountEstimationPhase.cpp',
  'JavaScriptCore/dfg/DFGStoreBarrierElisionPhase.cpp',
  'JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp',
  'JavaScriptCore/dfg/DFGStructureAbstractValue.cpp',
  'JavaScriptCore/dfg/DFGStructureRegistrationPhase.cpp',
  'JavaScriptCore/dfg/DFGThreadData.cpp',
  'JavaScriptCore/dfg/DFGThunks.cpp',
  'JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp',
  'JavaScriptCore/dfg/DFGToFTLDeferredCompilationCallback.cpp',
  'JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp',
  'JavaScriptCore/dfg/DFGTransition.cpp',
  'JavaScriptCore/dfg/DFGTypeCheckHoistingPhase.cpp',
  'JavaScriptCore/dfg/DFGUnificationPhase.cpp',
  'JavaScriptCore/dfg/DFGUseKind.cpp',
  'JavaScriptCore/dfg/DFGValidate.cpp',
  'JavaScriptCore/dfg/DFGValueSource.cpp',
  'JavaScriptCore/dfg/DFGValueStrength.cpp',
  'JavaScriptCore/dfg/DFGVariableAccessData.cpp',
  'JavaScriptCore/dfg/DFGVariableAccessDataDump.cpp',
  'JavaScriptCore/dfg/DFGVariableEvent.cpp',
  'JavaScriptCore/dfg/DFGVariableEventStream.cpp',
  'JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp',
  'JavaScriptCore/dfg/DFGWatchpointCollectionPhase.cpp',
  'JavaScriptCore/dfg/DFGWorklist.cpp',
  'JavaScriptCore/disassembler/ARM64/A64DOpcode.cpp',
  'JavaScriptCore/disassembler/ARM64Disassembler.cpp',
  'JavaScriptCore/disassembler/ARMv7/ARMv7DOpcode.cpp',
  'JavaScriptCore/disassembler/ARMv7Disassembler.cpp',
  'JavaScriptCore/disassembler/Disassembler.cpp',
  'JavaScriptCore/disassembler/LLVMDisassembler.cpp',
  'JavaScriptCore/disassembler/UDis86Disassembler.cpp',
  'JavaScriptCore/disassembler/X86Disassembler.cpp',
  'JavaScriptCore/ftl/FTLAbstractHeap.cpp',
  'JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp',
  'JavaScriptCore/ftl/FTLAvailableRecovery.cpp',
  'JavaScriptCore/ftl/FTLCapabilities.cpp',
  'JavaScriptCore/ftl/FTLCommonValues.cpp',
  'JavaScriptCore/ftl/FTLCompile.cpp',
  'JavaScriptCore/ftl/FTLDataSection.cpp',
  'JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp',
  'JavaScriptCore/ftl/FTLDWARFRegister.cpp',
  'JavaScriptCore/ftl/FTLExitArgument.cpp',
  'JavaScriptCore/ftl/FTLExitArgumentForOperand.cpp',
  'JavaScriptCore/ftl/FTLExitPropertyValue.cpp',
  'JavaScriptCore/ftl/FTLExitThunkGenerator.cpp',
  'JavaScriptCore/ftl/FTLExitTimeObjectMaterialization.cpp',
  'JavaScriptCore/ftl/FTLExitValue.cpp',
  'JavaScriptCore/ftl/FTLFail.cpp',
  'JavaScriptCore/ftl/FTLForOSREntryJITCode.cpp',
  'JavaScriptCore/ftl/FTLInlineCacheSize.cpp',
  'JavaScriptCore/ftl/FTLIntrinsicRepository.cpp',
  'JavaScriptCore/ftl/FTLJITCode.cpp',
  'JavaScriptCore/ftl/FTLJITFinalizer.cpp',
  'JavaScriptCore/ftl/FTLJSCall.cpp',
  'JavaScriptCore/ftl/FTLLink.cpp',
  'JavaScriptCore/ftl/FTLLocation.cpp',
  'JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp',
  'JavaScriptCore/ftl/FTLOperations.cpp',
  'JavaScriptCore/ftl/FTLOSREntry.cpp',
  'JavaScriptCore/ftl/FTLOSRExit.cpp',
  'JavaScriptCore/ftl/FTLOSRExitCompiler.cpp',
  'JavaScriptCore/ftl/FTLOutput.cpp',
  'JavaScriptCore/ftl/FTLRecoveryOpcode.cpp',
  'JavaScriptCore/ftl/FTLRegisterAtOffset.cpp',
  'JavaScriptCore/ftl/FTLSaveRestore.cpp',
  'JavaScriptCore/ftl/FTLSlowPathCall.cpp',
  'JavaScriptCore/ftl/FTLSlowPathCallKey.cpp',
  'JavaScriptCore/ftl/FTLStackMaps.cpp',
  'JavaScriptCore/ftl/FTLState.cpp',
  'JavaScriptCore/ftl/FTLThunks.cpp',
  'JavaScriptCore/ftl/FTLUnwindInfo.cpp',
  'JavaScriptCore/ftl/FTLValueFormat.cpp',
  'JavaScriptCore/ftl/FTLValueRange.cpp',
  'JavaScriptCore/heap/BlockAllocator.cpp',
  'JavaScriptCore/heap/CodeBlockSet.cpp',
  'JavaScriptCore/heap/ConservativeRoots.cpp',
  'JavaScriptCore/heap/CopiedSpace.cpp',
  'JavaScriptCore/heap/CopyVisitor.cpp',
  'JavaScriptCore/heap/DeferGC.cpp',
  'JavaScriptCore/heap/EdenGCActivityCallback.cpp',
  'JavaScriptCore/heap/FullGCActivityCallback.cpp',
  'JavaScriptCore/heap/GCActivityCallback.cpp',
  'JavaScriptCore/heap/GCLogging.cpp',
  'JavaScriptCore/heap/GCThread.cpp',
  'JavaScriptCore/heap/GCThreadSharedData.cpp',
  'JavaScriptCore/heap/HandleSet.cpp',
  'JavaScriptCore/heap/HandleStack.cpp',
  'JavaScriptCore/heap/Heap.cpp',
  'JavaScriptCore/heap/HeapStatistics.cpp',
  'JavaScriptCore/heap/HeapTimer.cpp',
  'JavaScriptCore/heap/IncrementalSweeper.cpp',
  'JavaScriptCore/heap/JITStubRoutineSet.cpp',
  'JavaScriptCore/heap/MachineStackMarker.cpp',
  'JavaScriptCore/heap/MarkedAllocator.cpp',
  'JavaScriptCore/heap/MarkedBlock.cpp',
  'JavaScriptCore/heap/MarkedSpace.cpp',
  'JavaScriptCore/heap/MarkStack.cpp',
  'JavaScriptCore/heap/SlotVisitor.cpp',
  'JavaScriptCore/heap/SuperRegion.cpp',
  'JavaScriptCore/heap/Weak.cpp',
  'JavaScriptCore/heap/WeakBlock.cpp',
  'JavaScriptCore/heap/WeakHandleOwner.cpp',
  'JavaScriptCore/heap/WeakSet.cpp',
  'JavaScriptCore/heap/WriteBarrierBuffer.cpp',
  'JavaScriptCore/heap/WriteBarrierSupport.cpp',
  'JavaScriptCore/inspector/agents/InspectorAgent.cpp',
  'JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp',
  'JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp',
  'JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp',
  'JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp',
  'JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp',
  'JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp',
  'JavaScriptCore/inspector/ConsoleMessage.cpp',
  'JavaScriptCore/inspector/ContentSearchUtilities.cpp',
  'JavaScriptCore/inspector/EventLoop.cpp',
  'JavaScriptCore/inspector/IdentifiersFactory.cpp',
  'JavaScriptCore/inspector/InjectedScript.cpp',
  'JavaScriptCore/inspector/InjectedScriptBase.cpp',
  'JavaScriptCore/inspector/InjectedScriptHost.cpp',
  'JavaScriptCore/inspector/InjectedScriptManager.cpp',
  'JavaScriptCore/inspector/InjectedScriptModule.cpp',
  'JavaScriptCore/inspector/InspectorAgentRegistry.cpp',
  'JavaScriptCore/inspector/InspectorBackendDispatcher.cpp',
  'JavaScriptCore/inspector/InspectorValues.cpp',
  'JavaScriptCore/inspector/JavaScriptCallFrame.cpp',
  'JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp',
  'JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp',
  'JavaScriptCore/inspector/JSInjectedScriptHost.cpp',
  'JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp',
  'JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp',
  'JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp',
  'JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp',
  'JavaScriptCore/inspector/ScriptArguments.cpp',
  'JavaScriptCore/inspector/ScriptCallFrame.cpp',
  'JavaScriptCore/inspector/ScriptCallStack.cpp',
  'JavaScriptCore/inspector/ScriptCallStackFactory.cpp',
  'JavaScriptCore/inspector/ScriptDebugServer.cpp',
  'JavaScriptCore/interpreter/AbstractPC.cpp',
  'JavaScriptCore/interpreter/CallFrame.cpp',
  'JavaScriptCore/interpreter/Interpreter.cpp',
  'JavaScriptCore/interpreter/JSStack.cpp',
  'JavaScriptCore/interpreter/ProtoCallFrame.cpp',
  'JavaScriptCore/interpreter/StackVisitor.cpp',
  'JavaScriptCore/interpreter/VMInspector.cpp',
  'JavaScriptCore/jit/AccessorCallJITStubRoutine.cpp',
  'JavaScriptCore/jit/ArityCheckFailReturnThunks.cpp',
  'JavaScriptCore/jit/AssemblyHelpers.cpp',
  'JavaScriptCore/jit/ClosureCallStubRoutine.cpp',
  'JavaScriptCore/jit/ExecutableAllocator.cpp',
  'JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp',
  'JavaScriptCore/jit/GCAwareJITStubRoutine.cpp',
  'JavaScriptCore/jit/HostCallReturnValue.cpp',
  'JavaScriptCore/jit/JIT.cpp',
  'JavaScriptCore/jit/JITArithmetic.cpp',
  'JavaScriptCore/jit/JITArithmetic32_64.cpp',
  'JavaScriptCore/jit/JITCall.cpp',
  'JavaScriptCore/jit/JITCall32_64.cpp',
  'JavaScriptCore/jit/JITCode.cpp',
  'JavaScriptCore/jit/JITDisassembler.cpp',
  'JavaScriptCore/jit/JITExceptions.cpp',
  'JavaScriptCore/jit/JITInlineCacheGenerator.cpp',
  'JavaScriptCore/jit/JITOpcodes.cpp',
  'JavaScriptCore/jit/JITOpcodes32_64.cpp',
  'JavaScriptCore/jit/JITOperations.cpp',
  'JavaScriptCore/jit/JITOperationsMSVC64.cpp',
  'JavaScriptCore/jit/JITPropertyAccess.cpp',
  'JavaScriptCore/jit/JITPropertyAccess32_64.cpp',
  'JavaScriptCore/jit/JITStubRoutine.cpp',
  'JavaScriptCore/jit/JITStubs.cpp',
  'JavaScriptCore/jit/JITThunks.cpp',
  'JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp',
  'JavaScriptCore/jit/Reg.cpp',
  'JavaScriptCore/jit/RegisterPreservationWrapperGenerator.cpp',
  'JavaScriptCore/jit/RegisterSet.cpp',
  'JavaScriptCore/jit/Repatch.cpp',
  'JavaScriptCore/jit/ScratchRegisterAllocator.cpp',
  'JavaScriptCore/jit/TempRegisterSet.cpp',
  'JavaScriptCore/jit/ThunkGenerators.cpp',
  'JavaScriptCore/llint/LLIntCLoop.cpp',
  'JavaScriptCore/llint/LLIntData.cpp',
  'JavaScriptCore/llint/LLIntEntrypoint.cpp',
  'JavaScriptCore/llint/LLIntExceptions.cpp',
  'JavaScriptCore/llint/LLIntSlowPaths.cpp',
  'JavaScriptCore/llint/LLIntThunks.cpp',
  'JavaScriptCore/llint/LowLevelInterpreter.cpp',
  'JavaScriptCore/llvm/InitializeLLVM.cpp',
  'JavaScriptCore/llvm/InitializeLLVMLinux.cpp',
  'JavaScriptCore/llvm/InitializeLLVMMac.cpp',
  'JavaScriptCore/llvm/InitializeLLVMPOSIX.cpp',
  'JavaScriptCore/llvm/library/LLVMAnchor.cpp',
  'JavaScriptCore/llvm/library/LLVMExports.cpp',
  'JavaScriptCore/llvm/library/LLVMOverrides.cpp',
  'JavaScriptCore/llvm/LLVMAPI.cpp',
  'JavaScriptCore/parser/Lexer.cpp',
  'JavaScriptCore/parser/Nodes.cpp',
  'JavaScriptCore/parser/Parser.cpp',
  'JavaScriptCore/parser/ParserArena.cpp',
  'JavaScriptCore/parser/SourceCode.cpp',
  'JavaScriptCore/parser/SourceProvider.cpp',
  'JavaScriptCore/parser/SourceProviderCache.cpp',
  'JavaScriptCore/profiler/LegacyProfiler.cpp',
  'JavaScriptCore/profiler/Profile.cpp',
  'JavaScriptCore/profiler/ProfileGenerator.cpp',
  'JavaScriptCore/profiler/ProfileNode.cpp',
  'JavaScriptCore/profiler/ProfilerBytecode.cpp',
  'JavaScriptCore/profiler/ProfilerBytecodes.cpp',
  'JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp',
  'JavaScriptCore/profiler/ProfilerCompilation.cpp',
  'JavaScriptCore/profiler/ProfilerCompilationKind.cpp',
  'JavaScriptCore/profiler/ProfilerCompiledBytecode.cpp',
  'JavaScriptCore/profiler/ProfilerDatabase.cpp',
  'JavaScriptCore/profiler/ProfilerJettisonReason.cpp',
  'JavaScriptCore/profiler/ProfilerOrigin.cpp',
  'JavaScriptCore/profiler/ProfilerOriginStack.cpp',
  'JavaScriptCore/profiler/ProfilerOSRExit.cpp',
  'JavaScriptCore/profiler/ProfilerOSRExitSite.cpp',
  'JavaScriptCore/profiler/ProfilerProfiledBytecodes.cpp',
  'JavaScriptCore/replay/EncodedValue.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp',
  'JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp',
  'JavaScriptCore/runtime/ArgList.cpp',
  'JavaScriptCore/runtime/Arguments.cpp',
  'JavaScriptCore/runtime/ArgumentsIteratorConstructor.cpp',
  'JavaScriptCore/runtime/ArgumentsIteratorPrototype.cpp',
  'JavaScriptCore/runtime/ArrayBuffer.cpp',
  'JavaScriptCore/runtime/ArrayBufferNeuteringWatchpoint.cpp',
  'JavaScriptCore/runtime/ArrayBufferView.cpp',
  'JavaScriptCore/runtime/ArrayConstructor.cpp',
  'JavaScriptCore/runtime/ArrayIteratorConstructor.cpp',
  'JavaScriptCore/runtime/ArrayIteratorPrototype.cpp',
  'JavaScriptCore/runtime/ArrayPrototype.cpp',
  'JavaScriptCore/runtime/BooleanConstructor.cpp',
  'JavaScriptCore/runtime/BooleanObject.cpp',
  'JavaScriptCore/runtime/BooleanPrototype.cpp',
  'JavaScriptCore/runtime/CallData.cpp',
  'JavaScriptCore/runtime/CodeCache.cpp',
  'JavaScriptCore/runtime/CodeSpecializationKind.cpp',
  'JavaScriptCore/runtime/CommonIdentifiers.cpp',
  'JavaScriptCore/runtime/CommonSlowPaths.cpp',
  'JavaScriptCore/runtime/CommonSlowPathsExceptions.cpp',
  'JavaScriptCore/runtime/CompilationResult.cpp',
  'JavaScriptCore/runtime/Completion.cpp',
  'JavaScriptCore/runtime/ConsoleClient.cpp',
  'JavaScriptCore/runtime/ConsolePrototype.cpp',
  'JavaScriptCore/runtime/ConstructData.cpp',
  'JavaScriptCore/runtime/CustomGetterSetter.cpp',
  'JavaScriptCore/runtime/DataView.cpp',
  'JavaScriptCore/runtime/DateConstructor.cpp',
  'JavaScriptCore/runtime/DateConversion.cpp',
  'JavaScriptCore/runtime/DateInstance.cpp',
  'JavaScriptCore/runtime/DatePrototype.cpp',
  'JavaScriptCore/runtime/DumpContext.cpp',
  'JavaScriptCore/runtime/Error.cpp',
  'JavaScriptCore/runtime/ErrorConstructor.cpp',
  'JavaScriptCore/runtime/ErrorHandlingScope.cpp',
  'JavaScriptCore/runtime/ErrorInstance.cpp',
  'JavaScriptCore/runtime/ErrorPrototype.cpp',
  'JavaScriptCore/runtime/ExceptionFuzz.cpp',
  'JavaScriptCore/runtime/ExceptionHelpers.cpp',
  'JavaScriptCore/runtime/Executable.cpp',
  'JavaScriptCore/runtime/FunctionConstructor.cpp',
  'JavaScriptCore/runtime/FunctionExecutableDump.cpp',
  'JavaScriptCore/runtime/FunctionHasExecutedCache.cpp',
  'JavaScriptCore/runtime/FunctionPrototype.cpp',
  'JavaScriptCore/runtime/GetterSetter.cpp',
  'JavaScriptCore/runtime/Identifier.cpp',
  'JavaScriptCore/runtime/IndexingType.cpp',
  'JavaScriptCore/runtime/InitializeThreading.cpp',
  'JavaScriptCore/runtime/IntendedStructureChain.cpp',
  'JavaScriptCore/runtime/InternalFunction.cpp',
  'JavaScriptCore/runtime/JSAPIValueWrapper.cpp',
  'JavaScriptCore/runtime/JSArgumentsIterator.cpp',
  'JavaScriptCore/runtime/JSArray.cpp',
  'JavaScriptCore/runtime/JSArrayBuffer.cpp',
  'JavaScriptCore/runtime/JSArrayBufferConstructor.cpp',
  'JavaScriptCore/runtime/JSArrayBufferPrototype.cpp',
  'JavaScriptCore/runtime/JSArrayBufferView.cpp',
  'JavaScriptCore/runtime/JSArrayIterator.cpp',
  'JavaScriptCore/runtime/JSBoundFunction.cpp',
  'JavaScriptCore/runtime/JSCallee.cpp',
  'JavaScriptCore/runtime/JSCell.cpp',
  'JavaScriptCore/runtime/JSCJSValue.cpp',
  'JavaScriptCore/runtime/JSConsole.cpp',
  'JavaScriptCore/runtime/JSDataView.cpp',
  'JavaScriptCore/runtime/JSDataViewPrototype.cpp',
  'JavaScriptCore/runtime/JSDateMath.cpp',
  'JavaScriptCore/runtime/JSEnvironmentRecord.cpp',
  'JavaScriptCore/runtime/JSFunction.cpp',
  'JavaScriptCore/runtime/JSGlobalObject.cpp',
  'JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp',
  'JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp',
  'JavaScriptCore/runtime/JSLexicalEnvironment.cpp',
  'JavaScriptCore/runtime/JSLock.cpp',
  'JavaScriptCore/runtime/JSMap.cpp',
  'JavaScriptCore/runtime/JSMapIterator.cpp',
  'JavaScriptCore/runtime/JSNameScope.cpp',
  'JavaScriptCore/runtime/JSNotAnObject.cpp',
  'JavaScriptCore/runtime/JSObject.cpp',
  'JavaScriptCore/runtime/JSONObject.cpp',
  'JavaScriptCore/runtime/JSPromise.cpp',
  'JavaScriptCore/runtime/JSPromiseConstructor.cpp',
  'JavaScriptCore/runtime/JSPromiseDeferred.cpp',
  'JavaScriptCore/runtime/JSPromiseFunctions.cpp',
  'JavaScriptCore/runtime/JSPromisePrototype.cpp',
  'JavaScriptCore/runtime/JSPromiseReaction.cpp',
  'JavaScriptCore/runtime/JSPropertyNameEnumerator.cpp',
  'JavaScriptCore/runtime/JSProxy.cpp',
  'JavaScriptCore/runtime/JSScope.cpp',
  'JavaScriptCore/runtime/JSSegmentedVariableObject.cpp',
  'JavaScriptCore/runtime/JSSet.cpp',
  'JavaScriptCore/runtime/JSSetIterator.cpp',
  'JavaScriptCore/runtime/JSString.cpp',
  'JavaScriptCore/runtime/JSStringJoiner.cpp',
  'JavaScriptCore/runtime/JSSymbolTableObject.cpp',
  'JavaScriptCore/runtime/JSTypedArrayConstructors.cpp',
  'JavaScriptCore/runtime/JSTypedArrayPrototypes.cpp',
  'JavaScriptCore/runtime/JSTypedArrays.cpp',
  'JavaScriptCore/runtime/JSWeakMap.cpp',
  'JavaScriptCore/runtime/JSWithScope.cpp',
  'JavaScriptCore/runtime/JSWrapperObject.cpp',
  'JavaScriptCore/runtime/LiteralParser.cpp',
  'JavaScriptCore/runtime/Lookup.cpp',
  'JavaScriptCore/runtime/MapConstructor.cpp',
  'JavaScriptCore/runtime/MapData.cpp',
  'JavaScriptCore/runtime/MapIteratorConstructor.cpp',
  'JavaScriptCore/runtime/MapIteratorPrototype.cpp',
  'JavaScriptCore/runtime/MapPrototype.cpp',
  'JavaScriptCore/runtime/MathObject.cpp',
  'JavaScriptCore/runtime/MemoryStatistics.cpp',
  'JavaScriptCore/runtime/NameConstructor.cpp',
  'JavaScriptCore/runtime/NameInstance.cpp',
  'JavaScriptCore/runtime/NamePrototype.cpp',
  'JavaScriptCore/runtime/NativeErrorConstructor.cpp',
  'JavaScriptCore/runtime/NativeErrorPrototype.cpp',
  'JavaScriptCore/runtime/NumberConstructor.cpp',
  'JavaScriptCore/runtime/NumberObject.cpp',
  'JavaScriptCore/runtime/NumberPrototype.cpp',
  'JavaScriptCore/runtime/ObjectConstructor.cpp',
  'JavaScriptCore/runtime/ObjectPrototype.cpp',
  'JavaScriptCore/runtime/Operations.cpp',
  'JavaScriptCore/runtime/Options.cpp',
  'JavaScriptCore/runtime/PropertyDescriptor.cpp',
  'JavaScriptCore/runtime/PropertyNameArray.cpp',
  'JavaScriptCore/runtime/PropertySlot.cpp',
  'JavaScriptCore/runtime/PropertyTable.cpp',
  'JavaScriptCore/runtime/PrototypeMap.cpp',
  'JavaScriptCore/runtime/RegExp.cpp',
  'JavaScriptCore/runtime/RegExpCache.cpp',
  'JavaScriptCore/runtime/RegExpCachedResult.cpp',
  'JavaScriptCore/runtime/RegExpConstructor.cpp',
  'JavaScriptCore/runtime/RegExpMatchesArray.cpp',
  'JavaScriptCore/runtime/RegExpObject.cpp',
  'JavaScriptCore/runtime/RegExpPrototype.cpp',
  'JavaScriptCore/runtime/SamplingCounter.cpp',
  'JavaScriptCore/runtime/SetConstructor.cpp',
  'JavaScriptCore/runtime/SetIteratorConstructor.cpp',
  'JavaScriptCore/runtime/SetIteratorPrototype.cpp',
  'JavaScriptCore/runtime/SetPrototype.cpp',
  'JavaScriptCore/runtime/SimpleTypedArrayController.cpp',
  'JavaScriptCore/runtime/SmallStrings.cpp',
  'JavaScriptCore/runtime/SparseArrayValueMap.cpp',
  'JavaScriptCore/runtime/StrictEvalActivation.cpp',
  'JavaScriptCore/runtime/StringConstructor.cpp',
  'JavaScriptCore/runtime/StringObject.cpp',
  'JavaScriptCore/runtime/StringPrototype.cpp',
  'JavaScriptCore/runtime/StringRecursionChecker.cpp',
  'JavaScriptCore/runtime/Structure.cpp',
  'JavaScriptCore/runtime/StructureChain.cpp',
  'JavaScriptCore/runtime/StructureIDTable.cpp',
  'JavaScriptCore/runtime/StructureRareData.cpp',
  'JavaScriptCore/runtime/SymbolTable.cpp',
  'JavaScriptCore/runtime/TypedArrayController.cpp',
  'JavaScriptCore/runtime/TypedArrayType.cpp',
  'JavaScriptCore/runtime/TypeLocationCache.cpp',
  'JavaScriptCore/runtime/TypeProfiler.cpp',
  'JavaScriptCore/runtime/TypeProfilerLog.cpp',
  'JavaScriptCore/runtime/TypeSet.cpp',
  'JavaScriptCore/runtime/VM.cpp',
  'JavaScriptCore/runtime/VMEntryScope.cpp',
  'JavaScriptCore/runtime/Watchdog.cpp',
  'JavaScriptCore/runtime/WatchdogNone.cpp',
  'JavaScriptCore/runtime/WeakMapConstructor.cpp',
  'JavaScriptCore/runtime/WeakMapData.cpp',
  'JavaScriptCore/runtime/WeakMapPrototype.cpp',
  'JavaScriptCore/testRegExp.cpp',
  'JavaScriptCore/tools/CodeProfile.cpp',
  'JavaScriptCore/tools/CodeProfiling.cpp',
  'JavaScriptCore/yarr/RegularExpression.cpp',
  'JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp',
  'JavaScriptCore/yarr/YarrInterpreter.cpp',
  'JavaScriptCore/yarr/YarrJIT.cpp',
  'JavaScriptCore/yarr/YarrPattern.cpp',
  'JavaScriptCore/yarr/YarrSyntaxChecker.cpp',
]

genrule(
  name = 'regex_tables',
  out = 'RegExpJitTables.h',
  srcs = [
    'JavaScriptCore/create_regex_tables',
  ],
  cmd = 'python JavaScriptCore/create_regex_tables > $OUT',
)
JSC_HEADERS['RegExpJitTables.h'] = ':regex_tables'

genrule(
  name = 'keyword_lookup',
  out = 'KeywordLookup.h',
  srcs = [
    'JavaScriptCore/KeywordLookupGenerator.py',
    'JavaScriptCore/parser/Keywords.table',
  ],
  cmd = 'python JavaScriptCore/KeywordLookupGenerator.py JavaScriptCore/parser/Keywords.table > $OUT',
)
JSC_HEADERS['KeywordLookup.h'] = ':keyword_lookup'

genrule(
  name = 'create_hash_table',
  out = 'Lexer.lut.h',
  srcs = [
    'JavaScriptCore/create_hash_table',
    'JavaScriptCore/parser/Keywords.table',
  ],
  cmd = 'perl JavaScriptCore/create_hash_table JavaScriptCore/parser/Keywords.table -i > $OUT',
)
JSC_HEADERS['Lexer.lut.h'] = ':create_hash_table'


def to_lut_header(src):
  root, _ = os.path.splitext(src)
  return root + '.lut.h'


LUT_SOURCES = [
  'ArrayConstructor.cpp',
  'ArrayPrototype.cpp',
  'BooleanPrototype.cpp',
  'DateConstructor.cpp',
  'DatePrototype.cpp',
  'ErrorPrototype.cpp',
  'JSDataViewPrototype.cpp',
  'JSGlobalObject.cpp',
  'JSONObject.cpp',
  'MathObject.cpp',
  'NamePrototype.cpp',
  'NumberConstructor.cpp',
  'NumberPrototype.cpp',
  'ObjectConstructor.cpp',
  'RegExpConstructor.cpp',
  'RegExpObject.cpp',
  'RegExpPrototype.cpp',
  'StringConstructor.cpp',
]

for src in LUT_SOURCES:
  lut_header = to_lut_header(src)
  genrule(
    name = lut_header,
    out = lut_header,
    srcs = [
      'JavaScriptCore/create_hash_table',
      'JavaScriptCore/runtime/' + src,
    ],
    cmd = 'perl $SRCDIR/JavaScriptCore/create_hash_table $SRCDIR/JavaScriptCore/runtime/{0} -i > $OUT'.format(src),
  )
  JSC_HEADERS[lut_header] = ':' + lut_header


genrule(
  name = 'Bytecodes.h',
  out = 'Bytecodes.h',
  srcs = [
    'JavaScriptCore/generate-bytecode-files',
    'JavaScriptCore/bytecode/BytecodeList.json',
  ],
  cmd = ' '.join([
    'python',
    '$SRCDIR/JavaScriptCore/generate-bytecode-files',
    '--bytecodes_h', '$OUT',
    '$SRCDIR/JavaScriptCore/bytecode/BytecodeList.json',
  ]),
)
JSC_HEADERS['Bytecodes.h'] = ':Bytecodes.h'

genrule(
  name = 'InitBytecodes.asm',
  out = 'InitBytecodes.asm',
  srcs = [
    'JavaScriptCore/generate-bytecode-files',
    'JavaScriptCore/bytecode/BytecodeList.json',
  ],
  cmd = ' '.join([
    'python',
    '$SRCDIR/JavaScriptCore/generate-bytecode-files',
    '--init_bytecodes_asm', '$OUT',
    '$SRCDIR/JavaScriptCore/bytecode/BytecodeList.json',
  ]),
)

SOURCES = glob([
  'JavaScriptCore/offlineasm/*.rb',
  'JavaScriptCore/llint/*.rb',
  'JavaScriptCore/llint/*.asm',
  'JavaScriptCore/*.asm',
])
SOURCES.append(':InitBytecodes.asm')
for platform in ('android-armv7', 'android-x86'):
  source = 'LLIntAssembly.{0}.h'.format(platform)
  genrule(
    name = source,
    out = source,
    srcs = SOURCES,
    cmd = ' '.join([
      'ruby',
      'JavaScriptCore/offlineasm/asm.rb',
      '-IJavaScriptCore',
      '-I.',
      'JavaScriptCore/llint/LowLevelInterpreter.asm',
      '$(location :jscoffsetextractor#static,{0})'.format(platform),
      '$OUT',
    ]),
  )
  add_gen_source(source)

###### INSPECTOR SOURCES ######

INSPECTOR_SCRIPT = 'JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py'
INSPECTOR_DOMAINS = [
  'JavaScriptCore/inspector/protocol/Console.json',
  'JavaScriptCore/inspector/protocol/Debugger.json',
  'JavaScriptCore/inspector/protocol/GenericTypes.json',
  'JavaScriptCore/inspector/protocol/InspectorDomain.json',
  'JavaScriptCore/inspector/protocol/Runtime.json',
]
genrule(
  name = 'InspectorJS.json',
  out = 'InspectorJS.json',
  srcs = [INSPECTOR_SCRIPT] + INSPECTOR_DOMAINS,
  cmd =
    '$SRCDIR/{script} {sources} > $OUT'
    .format(script=INSPECTOR_SCRIPT, sources=' '.join(INSPECTOR_DOMAINS)),
)

# Run the script to generate all the inspector C/C++ sources and pack them into
# a zip file.
SCRIPT = 'JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py'
INSPECTOR_GENERATOR_SCRIPTS = [
  'JavaScriptCore/inspector/scripts/codegen/__init__.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_backend_commands.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_header.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_implementation.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_header.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_header.py',
  'JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_implementation.py',
  'JavaScriptCore/inspector/scripts/codegen/generator_templates.py',
  'JavaScriptCore/inspector/scripts/codegen/generator.py',
  'JavaScriptCore/inspector/scripts/codegen/models.py',
  'JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py',
  'JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py',
]
genrule(
  name = 'inspector_sources',
  out = 'inspector_sources.zip',
  srcs = [SCRIPT] + INSPECTOR_GENERATOR_SCRIPTS,
  cmd = SCRIPT + ' --framework JavaScriptCore --outputDir $TMP $(location :InspectorJS.json) && (cd $TMP && zip -r -0 $OUT *.cpp *.h)',
)

# Now unpack the source we care about via independent genrules so we
# can plug them into our sources and headers list.
INSPECTOR_SOURCES = [
  'InspectorJSBackendDispatchers.cpp',
  'InspectorJSFrontendDispatchers.cpp',
  'InspectorJSProtocolTypes.cpp',
  'InspectorJSBackendDispatchers.h',
  'InspectorJSFrontendDispatchers.h',
  'InspectorJSProtocolTypes.h',
]

for source in INSPECTOR_SOURCES:
  unpack_rule(source, ':inspector_sources')
  add_gen_source(source)

genrule(
  name = 'InjectedScriptSource.h',
  out = 'InjectedScriptSource.h',
  srcs = [
    'JavaScriptCore/inspector/scripts/jsmin.py',
    'JavaScriptCore/inspector/InjectedScriptSource.js',
    'JavaScriptCore/inspector/scripts/xxd.pl',
  ],
  cmd = ' && '.join([
    'echo "//# sourceURL=__WebInspectorInjectedScript__" > $TMP/InjectedScriptSource.min.js',
    'python JavaScriptCore/inspector/scripts/jsmin.py < JavaScriptCore/inspector/InjectedScriptSource.js >> $TMP/InjectedScriptSource.min.js',
    'perl JavaScriptCore/inspector/scripts/xxd.pl InjectedScriptSource_js $TMP/InjectedScriptSource.min.js $OUT',
  ]),
)
add_gen_source('InjectedScriptSource.h')

###### END INSPECTOR SOURCES ######

###### JSC Builtins ######

SCRIPT = 'JavaScriptCore/generate-js-builtins'
SOURCES = glob(['JavaScriptCore/builtins/*.js'])
genrule(
  name = 'JSCBuiltins',
  out = 'JSCBuiltins.zip',
  srcs = [SCRIPT] + SOURCES,
  cmd =
    'python {script} {sources} $TMP/JSCBuiltins.h && (cd $TMP && zip -r -0 $OUT *.h *.cpp)'
    .format(script=SCRIPT, sources=' '.join(SOURCES)),
)

BUILTINS_SOURCES = [
  'JSCBuiltins.h',
  'JSCBuiltins.cpp',
]
for source in BUILTINS_SOURCES:
  unpack_rule(source, ':JSCBuiltins')
  add_gen_source(source)

###### END JSC Builtins ######

cxx_library(
  name = 'jsc',
  soname = 'libjsc.so',
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  preprocessor_flags = [
    '-DWTF_USE_EXPORT_MACROS=1',
    '-DBUILDING_JavaScriptCore=1',
    '-DENABLE_JIT=1',
    '-DENABLE_DFG_JIT=0',
    '-DENABLE_LLINT=1',
    '-DINTPTR_MAX=LONG_MAX',
    '-DLOG_TAG="JavaScriptCore"',
  ],
  compiler_flags = [
    '-fvisibility=hidden',
  ],
  header_namespace = '',
  exported_headers = JSC_HEADERS,
  headers = subdir_glob([
    ('extra_headers', '*.h'),
    ('extra_headers', 'unicode/udat.h'),
  ]),
  srcs = JSC_SOURCES,
  deps = [
    ':wtf',
    ':wtfcollation',
    '//icu:common',
    '//icu:i18n',
  ],
  visibility = [
    'PUBLIC',
  ],
)

# JSC offset extractor: this extracts the offsets into various JSC internal
# structures that are then fed back into the low level interpreter

JSCOFFSETEXTRACTOR_HEADERS = {}
JSCOFFSETEXTRACTOR_HEADERS['LLIntDesiredOffsets.h'] = ':llint_desired_offsets'
JSCOFFSETEXTRACTOR_HEADERS['Bytecodes.h'] = ':Bytecodes.h'
JSCOFFSETEXTRACTOR_HEADERS.update(
  subdir_glob([
    ('JavaScriptCore', '*.h'),
    ('JavaScriptCore/API', '*.h'),
    ('', 'JavaScriptCore/API/*.h'),
    ('JavaScriptCore/assembler', '*.h'),
    ('JavaScriptCore/bindings', '*.h'),
    ('JavaScriptCore/builtins', '*.h'),
    ('JavaScriptCore/bytecode', '*.h'),
    ('JavaScriptCore/bytecompiler', '*.h'),
    ('JavaScriptCore/debugger', '*.h'),
    ('JavaScriptCore/disassembler', '*.h'),
    ('JavaScriptCore/dfg', '*.h'),
    ('JavaScriptCore/ForwardingHeaders', '**/*.h'),
    ('JavaScriptCore/ftl', '*.h'),
    ('JavaScriptCore/heap', '*.h'),
    ('JavaScriptCore/interpreter', '*.h'),
    ('JavaScriptCore/inspector', '*.h'),
    ('JavaScriptCore/inspector/agents', '*.h'),
    ('JavaScriptCore/llint', '*.h'),
    ('JavaScriptCore/jit', '*.h'),
    ('JavaScriptCore/parser', '*.h'),
    ('JavaScriptCore/profiler', '*.h'),
    ('JavaScriptCore/runtime', '*.h'),
    ('JavaScriptCore/tools', '*.h'),
    ('JavaScriptCore', 'yarr/*.h'),
  ]),
)

cxx_library(
  name = 'jscoffsetextractor',
  soname = 'libjscoffsetextractor.so',
  force_static = True,
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  preprocessor_flags = [
    '-DENABLE_JIT=1',
    '-DENABLE_DFG_JIT=0',
    '-DENABLE_LLINT=1',
  ],
  headers = JSCOFFSETEXTRACTOR_HEADERS,
  header_namespace = '',
  srcs = [
    'JavaScriptCore/llint/LLIntOffsetsExtractor.cpp',
  ],
  deps = [
    ':wtf',
  ],
)

